
package com.shop.cereshop.admin.controller.userAuth;

import cn.hutool.core.bean.BeanUtil;
import com.shop.cereshop.admin.service.buyer.CereBuyerUserService;
import com.shop.cereshop.admin.service.userAuth.UserRealnameAuthService;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
import com.shop.cereshop.commons.domain.userAuth.UserRealnameAuthRespond;
import com.shop.cereshop.commons.result.Result;
import com.shop.cereshop.commons.utils.EmptyUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**
 * <p>
 * 前端控制器
 * 用户实名认证表
 * </p>
 *
 * @author 
 * @date 2025-08-07
 */
@Slf4j
@RestController
@RequestMapping("/userRealnameAuth")
@Api(value = "UserRealnameAuth", tags = "用户实名认证表")
public class UserRealnameAuthController {

    @Resource
    private CereBuyerUserService cereBuyerUserService;

    @Resource
    private UserRealnameAuthService userRealnameAuthService;
    @GetMapping("getAuthInfo")
    @ApiOperation(value = "获取用户实名认证信息")
    public Result<UserRealnameAuthRespond> getAuthInfo(Long userId, HttpServletRequest request) {
        UserRealnameAuthRespond byUserId = userRealnameAuthService.findAuthInfoByUserId(userId);
        if (BeanUtil.isNotEmpty(byUserId)) {
            return new Result<UserRealnameAuthRespond>(byUserId, CoReturnFormat.SUCCESS);
        }
        return new Result<UserRealnameAuthRespond>("未查询到认证信息", "5001");
    }


//    @PutMapping("/audit")
//    @ApiOperation(value = "用户实名认证审核")
//    public Result audit(@RequestParam Integer statue, @RequestParam Long userId) {
//        if (statue==1){
//            Integer number  =userRealnameAuthService.updateStatue(statue,userId);
//            if (number>0) {
//                return new Result(CoReturnFormat.SUCCESS);
//            }
//        }
//        return new Result(CoReturnFormat.FAIL);
//
//    }

}
